home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
17 Bit Software 6: Level 6
/
17 Bit - Level 6 (1998)(Epic Marketing)[!].iso
/
quartz
/
q0867.dms
/
q0867.adf
/
TRAPDOOR.LZH
/
Rexx
/
TrimDir.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-01-16
|
845b
|
36 lines
/* Trim a directory
Usage: rx TrimDir <dir> <days>
Delete all files in the given directory <dir> that are older than <days>
days. The <dir> parameter may also contain a pattern specification to
select only certain files from the directory.
*/
CSI = '9b'x
OFF = CSI'0m'
BO = CSI'1m'
UL = CSI'4m'
KEOL = CSI'K'
CR = '0d'x
LF = '0a'x
parse arg dir days
if days<=0 then do
say "TrimDir.rexx: bad args"
return 10
end
call writech(stdout, 'Trimming' dir)
call writech(stdout, ',' days 'days')
date=space(date('n',date('i')-days),1,'-')
date=left(overlay(substr(date,10,2),date,8,2),9)
call writech(stdout, ',' date)
address command 'list >t:TrimDir.temp' dir 'upto' date 'lformat "delete %s%s quiet"'
address command 'execute t:TrimDir.temp'
address command "delete t:TrimDir.temp quiet"
call writech(stdout, LF)
return 0